package com.ebelter.myehc.ui.fragments;

import com.ebelter.btcomlib.bases.fragment.BaseFragment;
import com.ebelter.btcomlib.views.LevelColorView;

import android.os.Bundle;
import android.widget.TextView;



import com.ebelter.btcomlib.models.bluetooth.products.three2one.ThreeOneManager;
import com.ebelter.btcomlib.models.bluetooth.products.three2one.bean.ThreeOneMesureResultBean;

import com.ebelter.btcomlib.utils.ViewUtils;


import com.ebelter.myehc.R;
import com.ebelter.myehc.ui.view.CombinView5;
import com.ebelter.myehc.utils.ViewUtilsEHC;

import static com.ebelter.btcomlib.bases.activity.BaseActivity.getString_;


/**
 * 总胆固醇
 */

public class TCH_Fragment extends BaseFragment {
    public static final String TAG = "TCH_Fragment";
    LevelColorView tch_lcv;
    CombinView5 cb5_tch;
    @Override
    protected int setLayoutResouceId() {
        return R.layout.fragment_tch;
    }

    @Override
    protected void initView() {
        super.initView();
        FV();
    }

    private void FV() {
        tch_lcv=mRootView.findViewById(R.id.tch_lcv);
        cb5_tch=mRootView.findViewById(R.id.cb5_tch);
    }
    @Override
    protected void initData(Bundle arguments) {
        super.initData(arguments);
        ViewUtilsEHC.setCb5Title2(cb5_tch,N);
    }

    private TextView activityTopTittleTv;

    public void setActivityTopTittleTv(TextView activityTopTittleTv) {
        this.activityTopTittleTv = activityTopTittleTv;
    }

    public void setMesureResult(ThreeOneMesureResultBean mesureResult) {
        if (cb5_tch!=null)cb5_tch.setTitle2(mesureResult.mesureValue+"");
        int result = ThreeOneManager.computerTZHHResult(mesureResult.mesureValue);

        ViewUtils.displayView(tch_lcv);
        if (tch_lcv!=null)tch_lcv.setLevel(result);

        String resultDes=ThreeOneManager.computerTZHHResultDesc(result);
        ViewUtils.setTextViewStr(activityTopTittleTv,resultDes);
    }

    public void setMesureResult2Null() {
        if (cb5_tch!=null) cb5_tch.setTitle2(N);
        ViewUtils.goneView(tch_lcv);
        ViewUtils.setTextViewStr(activityTopTittleTv,getString_(R.string.zongdanguchun));
    }
}
